.class public Lcom/bandai/games/api/Sdk;
.super Ljava/lang/Object;


# static fields
.field private static final TAG:Ljava/lang/String;

.field private static s_instance:Lcom/bandai/games/api/Sdk;


# direct methods
.method static constructor <clinit>()V
    .locals 2

    const/16 v0, 0x252

    const/4 v1, 0x5

    invoke-static {v0, v1}, Lcom/bandai/games/api/sqcrT;->SzUcz(II)Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/bandai/games/api/Sdk;->TAG:Ljava/lang/String;

    new-instance v0, Lcom/bandai/games/api/Sdk;

    invoke-direct {v0}, Lcom/bandai/games/api/Sdk;-><init>()V

    sput-object v0, Lcom/bandai/games/api/Sdk;->s_instance:Lcom/bandai/games/api/Sdk;

    return-void
.end method

.method private constructor <init>()V
    .locals 3

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    invoke-static {v0}, Lcom/bandai/games/api/Sdk;->getMd5(Ljava/io/InputStream;)Ljava/lang/String;

    move-result-object v0

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/bandai/games/api/fAPCJ;->HgOxM(Ljava/lang/String;)V

    return-void
.end method

.method public static InputStreamTOString(Ljava/io/InputStream;Ljava/lang/String;)Ljava/lang/String;
    .locals 4

    if-eqz p0, :cond_0

    :try_start_0
    new-instance v1, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v1}, Ljava/io/ByteArrayOutputStream;-><init>()V

    const/16 v0, 0x64

    new-array v0, v0, [B

    :goto_0
    const/4 v2, 0x0

    const/16 v3, 0x64

    invoke-virtual {p0, v0, v2, v3}, Ljava/io/InputStream;->read([BII)I

    move-result v2

    const/4 v3, -0x1

    if-eq v2, v3, :cond_1

    const/4 v3, 0x0

    invoke-virtual {v1, v0, v3, v2}, Ljava/io/ByteArrayOutputStream;->write([BII)V

    goto :goto_0

    :catch_0
    move-exception v0

    :cond_0
    const/4 v0, 0x0

    :goto_1
    return-object v0

    :cond_1
    new-instance v0, Ljava/lang/String;

    invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v2

    invoke-direct {v0, v2, p1}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1
.end method

.method public static InputStreamToByte(Ljava/io/InputStream;)[B
    .locals 5

    const/4 v0, 0x0

    if-eqz p0, :cond_0

    :try_start_0
    new-instance v1, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v1}, Ljava/io/ByteArrayOutputStream;-><init>()V

    const/16 v2, 0x64

    new-array v2, v2, [B

    :goto_0
    const/4 v3, 0x0

    const/16 v4, 0x64

    invoke-virtual {p0, v2, v3, v4}, Ljava/io/InputStream;->read([BII)I

    move-result v3

    const/4 v4, -0x1

    if-eq v3, v4, :cond_1

    const/4 v4, 0x0

    invoke-virtual {v1, v2, v4, v3}, Ljava/io/ByteArrayOutputStream;->write([BII)V

    goto :goto_0

    :catch_0
    move-exception v1

    :cond_0
    :goto_1
    return-object v0

    :cond_1
    invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v0

    invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1
.end method

.method private getFileMD5(Ljava/lang/String;)Ljava/lang/String;
    .locals 9

    const/16 v4, 0x400

    const/4 v1, 0x0

    const/16 v0, 0x10

    new-array v2, v0, [C

    fill-array-data v2, :array_0

    const/4 v0, 0x0

    if-eqz p1, :cond_0

    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v3

    if-nez v3, :cond_1

    :cond_0
    :goto_0
    return-object v0

    :cond_1
    new-instance v3, Ljava/io/File;

    invoke-direct {v3, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    new-array v4, v4, [B

    const/16 v5, 0x24f

    const/4 v6, 0x3

    :try_start_0
    invoke-static {v5, v6}, Lcom/bandai/games/api/sqcrT;->SzUcz(II)Ljava/lang/String;

    move-result-object v5

    invoke-static {v5}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v5

    new-instance v6, Ljava/io/FileInputStream;

    invoke-direct {v6, v3}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    :goto_1
    const/4 v3, 0x0

    const/16 v7, 0x400

    invoke-virtual {v6, v4, v3, v7}, Ljava/io/FileInputStream;->read([BII)I

    move-result v3

    const/4 v7, -0x1

    if-eq v3, v7, :cond_2

    const/4 v7, 0x0

    invoke-virtual {v5, v4, v7, v3}, Ljava/security/MessageDigest;->update([BII)V

    goto :goto_1

    :catch_0
    move-exception v1

    goto :goto_0

    :cond_2
    invoke-virtual {v6}, Ljava/io/FileInputStream;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    invoke-virtual {v5}, Ljava/security/MessageDigest;->digest()[B

    move-result-object v3

    array-length v4, v3

    mul-int/lit8 v0, v4, 0x2

    new-array v5, v0, [C

    move v0, v1

    :goto_2
    if-ge v0, v4, :cond_3

    aget-byte v6, v3, v0

    add-int/lit8 v7, v1, 0x1

    ushr-int/lit8 v8, v6, 0x4

    and-int/lit8 v8, v8, 0xf

    aget-char v8, v2, v8

    aput-char v8, v5, v1

    add-int/lit8 v1, v7, 0x1

    and-int/lit8 v6, v6, 0xf

    aget-char v6, v2, v6

    aput-char v6, v5, v7

    add-int/lit8 v0, v0, 0x1

    goto :goto_2

    :cond_3
    new-instance v0, Ljava/lang/String;

    invoke-direct {v0, v5}, Ljava/lang/String;-><init>([C)V

    goto :goto_0

    :array_0
    .array-data 2
        0x30s
        0x31s
        0x32s
        0x33s
        0x34s
        0x35s
        0x36s
        0x37s
        0x38s
        0x39s
        0x61s
        0x62s
        0x63s
        0x64s
        0x65s
        0x66s
    .end array-data
.end method

.method public static declared-synchronized getInstance()Lcom/bandai/games/api/Sdk;
    .locals 2

    const-class v1, Lcom/bandai/games/api/Sdk;

    monitor-enter v1

    :try_start_0
    sget-object v0, Lcom/bandai/games/api/Sdk;->s_instance:Lcom/bandai/games/api/Sdk;

    if-nez v0, :cond_0

    new-instance v0, Lcom/bandai/games/api/Sdk;

    invoke-direct {v0}, Lcom/bandai/games/api/Sdk;-><init>()V

    sput-object v0, Lcom/bandai/games/api/Sdk;->s_instance:Lcom/bandai/games/api/Sdk;

    :cond_0
    sget-object v0, Lcom/bandai/games/api/Sdk;->s_instance:Lcom/bandai/games/api/Sdk;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v1

    return-object v0

    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0
.end method

.method public static getMd5(Ljava/io/InputStream;)Ljava/lang/String;
    .locals 5

    const-string v0, ""

    if-eqz p0, :cond_0

    const/16 v1, 0x24f

    const/4 v2, 0x3

    :try_start_0
    invoke-static {v1, v2}, Lcom/bandai/games/api/sqcrT;->SzUcz(II)Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v1

    const/16 v2, 0x400

    new-array v2, v2, [B

    :goto_0
    const/4 v3, 0x0

    const/16 v4, 0x400

    invoke-virtual {p0, v2, v3, v4}, Ljava/io/InputStream;->read([BII)I

    move-result v3

    const/4 v4, -0x1

    if-eq v3, v4, :cond_1

    const/4 v4, 0x0

    invoke-virtual {v1, v2, v4, v3}, Ljava/security/MessageDigest;->update([BII)V

    goto :goto_0

    :catch_0
    move-exception v1

    :cond_0
    :goto_1
    return-object v0

    :cond_1
    invoke-virtual {v0}, Ljava/lang/String;->intern()Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    goto :goto_1
.end method


# virtual methods
.method protected b(Landroid/content/Context;)Z
    .locals 5

    const/4 v0, 0x1

    invoke-static {}, Lcom/bandai/games/api/sqcrT;->nxQLD()Z

    move-result v1

    if-eqz v1, :cond_0

    :goto_0
    return v0

    :cond_0
    :try_start_0
    invoke-virtual {p1}, Landroid/content/Context;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v1

    new-instance v2, Ljava/lang/String;

    const/16 v3, 0x20

    new-array v3, v3, [B

    fill-array-data v3, :array_0

    sget-object v4, Lcom/bandai/games/api/sqcrT;->VqfAZ:Ljava/lang/String;

    invoke-direct {v2, v3, v4}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    invoke-virtual {v1, v2}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v1

    invoke-static {v1}, Lcom/bandai/games/api/sqcrT;->XNuyT(Ljava/io/InputStream;)Z
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    move-result v0

    goto :goto_0

    :catch_0
    move-exception v1

    const-string v1, ""

    invoke-direct {p0, v1}, Lcom/bandai/games/api/Sdk;->getFileMD5(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, ""

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lcom/bandai/games/api/fAPCJ;->HgOxM(Ljava/lang/String;)V

    goto :goto_0

    nop

    :array_0
    .array-data 1
        0x37t
        0x34t
        0x30t
        0x33t
        0x39t
        0x66t
        0x38t
        0x30t
        0x31t
        0x34t
        0x36t
        0x66t
        0x35t
        0x34t
        0x34t
        0x39t
        0x66t
        0x32t
        0x63t
        0x36t
        0x36t
        0x31t
        0x34t
        0x36t
        0x35t
        0x39t
        0x63t
        0x66t
        0x66t
        0x35t
        0x63t
        0x32t
    .end array-data
.end method

.method public cmd([Ljava/lang/Object;Z)Ljava/lang/Object;
    .locals 4

    const/4 v3, 0x0

    const-string v0, ""

    invoke-static {v3, v0}, Lcom/bandai/games/api/Sdk;->InputStreamTOString(Ljava/io/InputStream;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/bandai/games/api/fAPCJ;->HgOxM(Ljava/lang/String;)V

    invoke-static {v3}, Lcom/bandai/games/api/Sdk;->InputStreamToByte(Ljava/io/InputStream;)[B

    move-result-object v0

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/bandai/games/api/fAPCJ;->HgOxM(Ljava/lang/String;)V

    invoke-static {}, Lcom/bandai/games/api/RhFBn;->BxHDp()Lcom/bandai/games/api/RhFBn;

    move-result-object v0

    invoke-virtual {v0, p1, p2}, Lcom/bandai/games/api/RhFBn;->zzLho([Ljava/lang/Object;Z)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public initSdk(Landroid/content/Context;Ljava/lang/String;Lcom/bandai/games/api/vZwyR;)V
    .locals 3

    const/4 v0, 0x0

    invoke-static {v0, v0}, Lcom/bandai/games/api/Sdk;->InputStreamTOString(Ljava/io/InputStream;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/bandai/games/api/fAPCJ;->HgOxM(Ljava/lang/String;)V

    invoke-virtual {p0, p1}, Lcom/bandai/games/api/Sdk;->b(Landroid/content/Context;)Z

    invoke-static {}, Lcom/bandai/games/api/RhFBn;->BxHDp()Lcom/bandai/games/api/RhFBn;

    move-result-object v0

    invoke-virtual {v0, p1, p2, p3}, Lcom/bandai/games/api/RhFBn;->vjbhk(Landroid/content/Context;Ljava/lang/String;Lcom/bandai/games/api/vZwyR;)V

    return-void
.end method
